//卡劵管理-卡劵列表
App.util.ns('Admin.Card.Card');
App.pages.add((function(){
    var NS = Admin.Card.Card;
    var page = new App.Page({
        name: 'card/card/index'
    });
    //页面初始化
    page.initStack.add('dataTable', function(){
        //面包屑导航
        this.setBreadcrumb([{
            icon: '<i class="fa fa-credit-card"></i>',
            content: '卡劵管理'
        }, {
            content: '卡劵列表'
        }]);
        this.dataTable = new App.DataTable({
            baseUrl: '/admin/card/card',
            dataUrl: 'lists',
            table: {
                id: 'id',
                main: 0,
                showId: true,
                columns: App.util.copy(NS.Conf.columns)
            },
            filter: [
                {type: 'keywords'},
                {type: 'timeRange'},
                {type: 'select', name: 'type', title: '类型', width: '80px', items: [
                    [1, '系统充值'],
                    [2, '卡劵充值'],
                ]}
            ],
            menu: [
                {parent: 'add', permission: 'op:admin.card.card.create'},
                {parent: 'view', permission: 'op:admin.card.card.detail'},
                {parent: 'edit', permission: 'op:admin.card.card.update'},
                {parent: 'drop', permission: 'op:admin.card.card.delete'},
                {parent: 'multiDrop', permission: 'op:admin.card.card.multiDelete'}
            ],
            detail: {
                form: {
                    items: App.util.copy(NS.Conf.form)
                }
            },
        }, page);
        this.dataTable.fix(this.contentContainer);
        this.dataTable.loadData();
    });
    //页面刷新
    page.refreshStack.add('dataTable', function(){
        this.dataTable.loadData(true);
    });
    //页面销毁
    page.destroyStack.add('dataTable', function(){
        this.dataTable.destroy();
    });
    return page;
})());